package cs5300;

import java.text.SimpleDateFormat;
import java.util.Date;

import BasicDataType.IPP;
import RPC.RPCclient;

public class indexDisplayWrapper {
	public static String message = "initial";
	public static String ServerIDEXE = "initial";
	public static String ServerFound = "initial";
	public static String DiscardTime = "initial";
	public static String evict = "initial";
	public static String MbrSet = "initial";
	
	
	public static void initial(){
		 message = "initial";
		 ServerIDEXE = "initial";
		 ServerFound = "initial";
		 DiscardTime = "initial";
		 evict = "initial";
		 MbrSet = "initial";
	}
	public static void UpdateServerEXE(IPP server){
		ServerIDEXE = "the excute host is : " + server.IPaddress.getHostAddress() + "the port is" + Integer.toString(server.Port);
	}
	
	public static void UpdateServerFound(IPP server){
		ServerFound = "the found host is : " + server.IPaddress.getHostAddress() + "the port is" + Integer.toString(server.Port);
	}
	
	public static void UpdateDiscardTime(long discard_time){
	    Date time = new Date();
	    time.setTime(discard_time);
	    SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd G 'at' hh:mm:ss z");
	    DiscardTime =  sdf.format(time); 
	}
	
	public static void UpdateMbrSet(){
		for(int i = 0; i < RPCclient.desList.size(); i++){
			MbrSet += RPCclient.desList.get(i).getString();
		}
	}
	
}
